﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Common.Utility
{
    public class PageInfo
    {
        public PageInfo()
        {
            this.TableName = "";
            this.ColumnNames = "";
            this.CurPageIndex = 1;
            this.BeginPageIndex = 1;
            this.EndPageIndex = 10;
            this.TotalCount = 0;
            this.OrderPlace = null;
            this.PageSize = 10;
            this.StrWhere = "";
            this.Distinct = false;
            this.Wherelist = new Dictionary<string, string>();
        }

        #region 分页部分

        public String TableName { get; set; }

        public bool Distinct { get; set; }

        public string ColumnNames { get; set; }

        public int PageSize { get; set; }

        public int CurPageIndex { get; set; }
        public int BeginPageIndex { get; set; }
        public int EndPageIndex { get; set; }

        public string StrWhere { get; set; }

        public String OrderPlace { get; set; }

        public int TotalCount { get; set; }

        public Dictionary<string, string> Wherelist { get; set; }

        public int MaxPage
        {
            get
            {
                int maxPage = 0;
                maxPage = TotalCount % PageSize > 0 ? 1 : 0;
                return TotalCount / PageSize + maxPage;
            }
        }

        #endregion
    }
}
